package com.payge.firework

import android.app.Application
import android.content.pm.ApplicationInfo
import timber.log.Timber

class TheApp: Application() {

    override fun onCreate() {
        super.onCreate()
        val debugFlag = applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE
        if (debugFlag == 0) {
            println("application.onCreate in release")
            Timber.plant(ReleaseTree())
        } else {
            println("application.onCreate in debug")
            Timber.plant(Timber.DebugTree())
        }
    }

}

private class ReleaseTree: Timber.DebugTree() {
    override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
        //super.log(priority, tag, message, t)
    }
}